package com.wangzhenyu.learn

import android.os.Bundle
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import com.wangzhenyu.learn.databinding.TestName
import com.wangzhenyu.learn.test.bean.MySelf
import com.wangzhenyu.learn.test.bean.User
import com.wangzhenyu.learn.test.handler.MainClickHandler
import com.wangzhenyu.learn.test.jetpack.lifecycle_.NoteOfLifecycle

@Suppress("UNUSED")
class MainActivity : AppCompatActivity() {

    private val model: MainViewModel by viewModels()


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        //这里使用Databinding
        val binding = DataBindingUtil.setContentView<TestName>(this, R.layout.activity_main)
        binding.user = User(MySelf())
        binding.handler = MainClickHandler()

    }


    override fun onStart() {
        super.onStart()
        lifecycle.addObserver(NoteOfLifecycle.MyObserver())
    }
}
